#import "GKCover.h"
#import "dfhgwhruebvhrheyoutwarddelegate.h"
#import "dfhgwhruebvhrheybangorganismViewController.h"
#import "dfhgwhruebvhrheyattractiveleapViewController.h"
#import "dfhgwhruebvhrheyaluminiumdisorder.h"
#import "dfhgwhruebvhrheymemorialdisplayViewController.h"
#import "dfhgwhruebvhrheycandidateroutineViewController.h"
#import "dfhgwhruebvhrheyinsistspecializeViewController.h"
#import "dfhgwhruebvhrheyoccurrenceadditionalViewController.h"
#import "dfhgwhruebvhrheydisplayblastViewController.h"
#import "dfhgwhruebvhrheybulletinalterViewController.h"
#import "dfhgwhruebvhrheylunarreceiptViewController.h"
#import "dfhgwhruebvhrheynamelyprevalentViewController.h"
@interface dfhgwhruebvhrheyattractiveleapViewController ()
@property (weak, nonatomic) IBOutlet UIView *topView;
@property (weak, nonatomic) IBOutlet UILabel *phoneText;
@property (weak, nonatomic) IBOutlet UILabel *welcomeText;
@property (weak, nonatomic) IBOutlet UIButton *loginBtn;
@property (weak, nonatomic) IBOutlet UIView *sectionView1;
@property (weak, nonatomic) IBOutlet UIView *sectionView2;
@property (weak, nonatomic) IBOutlet UIButton *logoutBtn;
@end
@implementation dfhgwhruebvhrheyattractiveleapViewController
- (void)viewWillAppear:(BOOL)animated {
	[super viewWillAppear:animated];
	self.navigationController.navigationBarHidden = YES;
}
- (void)viewWillDisappear:(BOOL)animated {
	[super viewWillDisappear:animated];
	self.navigationController.navigationBarHidden = NO;
}
- (void)viewDidLoad {
	[super viewDidLoad];
	[self updateStatus];
	self.view.backgroundColor = bg_color1.dhgfywegwygeydwlearneddesignate;
    self.topView.backgroundColor = primary_color.dhgfywegwygeydwlearneddesignate;
    self.sectionView1.backgroundColor = sep_color1.dhgfywegwygeydwlearneddesignate;
    self.logoutBtn.backgroundColor = primary_color.dhgfywegwygeydwlearneddesignate;
    [self.logoutBtn setTitle:@"Logout" forState:UIControlStateNormal];
    self.sectionView1.layer.cornerRadius = 12;
    self.sectionView1.layer.masksToBounds = YES;
    self.sectionView2.layer.cornerRadius = 12;
    self.sectionView2.layer.masksToBounds = YES;
    self.logoutBtn.layer.cornerRadius = 10;
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatus) name:dhgfywegwygeydwembarrassurgent object:nil];
}
- (void)updateStatus {
	if (![dfhgwhruebvhrheyoptionsaving isLogin]) {
        self.loginBtn.hidden = NO;
        self.logoutBtn.hidden = YES;
        self.phoneText.hidden = YES;
        self.welcomeText.hidden = YES;
        [self.loginBtn addUnderLine:1 andColor:white_color.dhgfywegwygeydwlearneddesignate];
	}else {
        self.loginBtn.hidden = YES;
        self.logoutBtn.hidden = NO;
        self.phoneText.hidden = NO;
        self.welcomeText.hidden = NO;
		NSString *mobile = [[dfhgwhruebvhrheyoptionsaving getUserData].phone mutableCopy];
		if (![mobile hasPrefix:@"0"]) {
            mobile = [NSString stringWithFormat:@"0%@",mobile];
		}
        mobile = [mobile stringByReplacingCharactersInRange:NSMakeRange(4, 4) withString:@"****"];
        self.phoneText.text = mobile;
	}
}
- (void)changePhoneNumberAction {
    dfhgwhruebvhrheybulletinalterViewController *changeVC = [[dfhgwhruebvhrheybulletinalterViewController alloc] init];
    changeVC.isCurrentMobile = YES;
    changeVC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:changeVC animated:YES];
}
- (IBAction)loginAction {
	__weak typeof(self) weakSelf = self;
	if (![dfhgwhruebvhrheyoptionsaving isLogin]) {
		return [dfhgwhruebvhrheyoptionsaving login:^{
			__strong typeof(weakSelf) strongSelf = weakSelf;
			[strongSelf goHome];
		}];
	}
}
- (IBAction)logoutAction {
    [dfhgwhruebvhrheyoptionsaving logout];
}
- (IBAction)itemDidSelect:(UITapGestureRecognizer *)sender {
    if (![dfhgwhruebvhrheyoptionsaving isLogin]) {
        return [dfhgwhruebvhrheyoptionsaving login:nil];
    }
    UIView *iv = [sender view];
    switch (iv.tag) {
        case 100: {
            dfhgwhruebvhrheydisplayblastViewController *record = (dfhgwhruebvhrheydisplayblastViewController *)[UIStoryboard storyboard:@"Mine" withidentifier:@"record"];
            record.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:record animated:YES];
        }
            break;
        case 101: {
            dfhgwhruebvhrheynamelyprevalentViewController *center = (dfhgwhruebvhrheynamelyprevalentViewController *)[UIStoryboard storyboard:@"Home" withidentifier:@"authentication"];
            center.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:center animated:YES];
        }
            break;
        case 200: {
            dfhgwhruebvhrheymemorialdisplayViewController *about = (dfhgwhruebvhrheymemorialdisplayViewController *)[UIStoryboard storyboard:@"Mine" withidentifier:@"about"];
            about.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:about animated:YES];
        }
            break;
        case 201: {
            [self changePhoneNumberAction];
        }
            break;
        case 202: {
            NSLog(@"语言切换");
        }
            break;
        case 203: {
            dfhgwhruebvhrheylunarreceiptViewController *delete = (dfhgwhruebvhrheylunarreceiptViewController *)[UIStoryboard storyboard:@"Mine" withidentifier:@"delete_account"];
            delete.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:delete animated:YES];
        }
            break;
        case 204: {
            dfhgwhruebvhrheybangorganismViewController *webVC = [[dfhgwhruebvhrheybangorganismViewController alloc] init];
            webVC.isShowBottomView = NO;
            webVC.hidesBottomBarWhenPushed = YES;
            [webVC loadURLString:privateProtocalH5];
            webVC.navigationItem.title = @"Privacy Policy";
            [self.navigationController pushViewController:webVC animated:YES];
        }
            break;
        default:
            break;
    }
}
- (void)goHome {
	dfhgwhruebvhrheycandidateroutineViewController *tabBar = (dfhgwhruebvhrheycandidateroutineViewController *)[dfhgwhruebvhrheyoptionsaving.keyWindow rootViewController];
	tabBar.selectedIndex = 0;
}
@end
